﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace PrinterBudi.Persistence
{
    public class PBUser
    {
        public PBUser()
        {
            PBTransactions = new List<PBTransaction>();
        }

        public virtual int Id { set; get; }
        public virtual string PhoneNumber { set; get; }
        public virtual string Password { set; get; }
        public virtual string Name { set; get; }
        public virtual string Address { set; get; }
        public virtual int VerSuccess { set; get; }
        public virtual IList<PBTransaction> PBTransactions { set; get; }
    }

    public class PBUserMap : ClassMap<PBUser>
    {
        public PBUserMap()
        {
            Id(x => x.Id, "Id").GeneratedBy.Increment();
            Map(x => x.PhoneNumber, "PhoneNumber");
            Map(x => x.Password, "Password");
            Map(x => x.Name, "Name");
            Map(x => x.Address, "Address");
            Map(x => x.VerSuccess, "VerSuccess");
            HasMany<PBTransaction>(x => x.PBTransactions).Table("PBTransaction").KeyColumn("PBUserId");
            Table("PBUser");
        }
    }
}
